libs = user32.lib gdi32.lib kernel32.lib comctl32.lib

!message nmake usage:
!message 'nmake'           : build debug version.
!message 'nmake release='  : build release version.
!message 'nmake clean'     : clean workshop
!message

lkf = /nologo
lbf = /nologo
mtf = -nologo

!ifdef release
clf = /nologo /c /MD /DNDEBUG
!else
clf = /nologo /c /MD
!endif

!ifdef release

!else

!endif
all : dynamic.dll t.exe

dynamic.dll dynamic.lib : dynamic.obj
	link $(lkf) /dll /def:dynamic.def /out:$@ $** $(libs) ws2_32.lib /libpath:%SDK32%\lib \
!ifdef release
	msg_mark_r.lib
!else
	msg_mark_d.lib
!endif
	@if exist $*.dll.manifest (mt $(mtf) -manifest $*.dll.manifest -outputresource:$*.dll;2 & del $*.dll.manifest)

dynamic.obj : dynamic.c
	cl $(clf) /I%SDK32%\include /Ddynamic $**

t.exe : t.obj dynamic.lib
	link $**
	@if exist $*.exe.manifest (mt $(mtf) -manifest $*.exe.manifest -outputresource:$*.exe & del $*.exe.manifest)

t.obj : t.c
	cl $(clf) /I%SDK32%\include $**
	
clean:
	if exist *.obj (del *.obj)
	if exist *.exe (del *.exe)
	if exist *.dll (del *.dll)
	if exist *.manifest (del *.manifest)
	if exist *.res (del *.res)
	if exist *.exp (del *.exp)
	if exist *.lib (del *.lib)
	if exist *.txt (del *.txt)
